home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / e / gencodee_v21.lha / GenCodeE / E / Localized_DemoGenCodeE30b / GUI.em < prev    next >
Text File  |  1994-11-15  |  7KB  |  203 lines

  1. OPT MODULE
  2.  
  3.  
  4. /*/////////////////////////////////////////////////////////////////////////////
  5. ///////////////////////////////////////////////////////////// Macro files /////
  6. ///////////////////////////////////////////////////////////////////////////////
  7. MACROS 'MUI.pma'
  8. */
  9.  
  10.  
  11. ->/////////////////////////////////////////////////////////////////////////////
  12. ->////////////////////////////////////////////////////// External modules /////
  13. ->/////////////////////////////////////////////////////////////////////////////
  14. MODULE 'muimaster' , 'libraries/mui'
  15. MODULE 'tools/boopsi'
  16. MODULE 'utility/tagitem' , 'utility/hooks'
  17.  
  18. MODULE '*Locale'
  19.  
  20.  
  21. ->/////////////////////////////////////////////////////////////////////////////
  22. ->//////////////////////////////////////////////////// Object definitions /////
  23. ->/////////////////////////////////////////////////////////////////////////////
  24. EXPORT OBJECT app_arexx
  25.     commands :    PTR TO mui_command
  26.     error    :    hook
  27. ENDOBJECT
  28.  
  29. EXPORT OBJECT app_display
  30.     button_pressed          :    hook
  31. ENDOBJECT
  32.  
  33. EXPORT OBJECT app_obj
  34.     app                     :    PTR TO LONG
  35.     wi_the_window           :    PTR TO LONG
  36.     bt_put_constant_string  :    PTR TO LONG
  37.     bt_put_variable         :    PTR TO LONG
  38.     bt_return_id            :    PTR TO LONG
  39.     bt_call_hook            :    PTR TO LONG
  40.     tx_result               :    PTR TO LONG
  41.     bt_quit                 :    PTR TO LONG
  42.     stR_TX_result           :    PTR TO CHAR
  43. ENDOBJECT
  44.  
  45.  
  46. ->/////////////////////////////////////////////////////////////////////////////
  47. ->////////////////////////////////////////////////// Constant definitions /////
  48. ->/////////////////////////////////////////////////////////////////////////////
  49. EXPORT ENUM
  50.     ID_BUTTON_PRESSED = 1
  51.  
  52.  
  53. ->/////////////////////////////////////////////////////////////////////////////
  54. ->/////////////////////////////////////////// Global variable definitions /////
  55. ->/////////////////////////////////////////////////////////////////////////////
  56. EXPORT DEF string_var
  57.  
  58. EXPORT DEF cat : PTR TO catalog_DemoGenCodeE
  59.  
  60.  
  61. ->/////////////////////////////////////////////////////////////////////////////
  62. ->/////////// Creates one instance of one object or the whole application /////
  63. ->/////////////////////////////////////////////////////////////////////////////
  64. PROC create( display : PTR TO app_display ,
  65.              icon  = NIL ,
  66.              arexx = NIL : PTR TO app_arexx ,
  67.              menu  = NIL ) OF app_obj
  68.  
  69.     DEF grOUP_ROOT_0C , gr_grp_0 , gr_grp_1 , la_result , gr_grp_2
  70.  
  71.     self.stR_TX_result           := cat.msg_TX_result.getstr()
  72.  
  73.     self.bt_put_constant_string := SimpleButton( getMBstring( cat.msg_BT_put_constant_string.getstr() ) )
  74.  
  75.     self.bt_put_variable := SimpleButton( getMBstring( cat.msg_BT_put_variable.getstr() ) )
  76.  
  77.     self.bt_return_id := SimpleButton( getMBstring( cat.msg_BT_return_id.getstr() ) )
  78.  
  79.     self.bt_call_hook := SimpleButton( getMBstring( cat.msg_BT_call_hook.getstr() ) )
  80.  
  81.     la_result := Label( getMBstring( cat.msg_LA_result.getstr() ) )
  82.  
  83.     self.tx_result := TextObject ,
  84.         MUIA_HelpNode , 'TX_result' ,
  85.         MUIA_Background , MUII_TextBack ,
  86.         MUIA_Frame , MUIV_Frame_Text ,
  87.         MUIA_Text_Contents , self.stR_TX_result ,
  88.         MUIA_Text_PreParse , '\el' ,
  89.         MUIA_Text_SetMin , MUI_TRUE ,
  90.     End
  91.  
  92.     gr_grp_1 := GroupObject ,
  93.         MUIA_Group_Horiz , MUI_TRUE ,
  94.         Child , la_result ,
  95.         Child , self.tx_result ,
  96.     End
  97.  
  98.     gr_grp_0 := GroupObject ,
  99.         MUIA_Frame , MUIV_Frame_Group ,
  100.         MUIA_FrameTitle , getMBstring( cat.msg_GR_grp_0Title.getstr() ) ,
  101.         Child , self.bt_put_constant_string ,
  102.         Child , self.bt_put_variable ,
  103.         Child , self.bt_return_id ,
  104.         Child , self.bt_call_hook ,
  105.         Child , gr_grp_1 ,
  106.     End
  107.  
  108.     self.bt_quit := SimpleButton( getMBstring( cat.msg_BT_quit.getstr() ) )
  109.  
  110.     gr_grp_2 := GroupObject ,
  111.         Child , self.bt_quit ,
  112.     End
  113.  
  114.     grOUP_ROOT_0C := GroupObject ,
  115.         Child , gr_grp_0 ,
  116.         Child , gr_grp_2 ,
  117.     End
  118.  
  119.     self.wi_the_window := WindowObject ,
  120.         MUIA_Window_Title , getMBstring( cat.msg_WI_the_window.getstr() ) ,
  121.         MUIA_HelpNode , 'WI_the_window' ,
  122.         MUIA_Window_ID , "0WIN" ,
  123.         WindowContents , grOUP_ROOT_0C ,
  124.     End
  125.  
  126.     self.app := ApplicationObject ,
  127.         ( IF icon THEN MUIA_Application_DiskObject ELSE TAG_IGNORE ) , icon ,
  128.         ( IF arexx THEN MUIA_Application_Commands ELSE TAG_IGNORE ) , ( IF arexx THEN arexx.commands ELSE NIL ) ,
  129.         ( IF arexx THEN MUIA_Application_RexxHook ELSE TAG_IGNORE ) , ( IF arexx THEN arexx.error ELSE NIL ) ,
  130.         ( IF menu THEN MUIA_Application_Menu ELSE TAG_IGNORE ) , menu ,
  131.         MUIA_Application_Author , 'Lionel Vintenat' ,
  132.         MUIA_Application_Base , 'DEMOGENCODEE' ,
  133.         MUIA_Application_Title , 'DemoGenCodeE' ,
  134.         MUIA_Application_Version , '$VER: DemoGenCodeE 1.0 (01.09.94)' ,
  135.         MUIA_Application_Copyright , getMBstring( cat.msg_AppCopyright.getstr() ) ,
  136.         MUIA_Application_Description , getMBstring( cat.msg_AppDescription.getstr() ) ,
  137.         SubWindow , self.wi_the_window ,
  138.     End
  139.  
  140. ENDPROC self.app
  141.  
  142.  
  143. ->/////////////////////////////////////////////////////////////////////////////
  144. ->////////////////////////// Disposes the object or the whole application /////
  145. ->/////////////////////////////////////////////////////////////////////////////
  146. PROC dispose() OF app_obj IS ( IF self.app THEN Mui_DisposeObject( self.app ) ELSE NIL )
  147.  
  148.  
  149. ->/////////////////////////////////////////////////////////////////////////////
  150. ->/////////////////////// Initializes all the notifications of one object /////
  151. ->/////////////////////////////////////////// or of the whole application /////
  152. ->/////////////////////////////////////////////////////////////////////////////
  153. PROC init_notifications( display : PTR TO app_display ) OF app_obj
  154.  
  155.     domethod( self.bt_put_constant_string , [
  156.         MUIM_Notify , MUIA_Pressed , FALSE ,
  157.         self.tx_result ,
  158.         3 ,
  159.         MUIM_Set , MUIA_Text_Contents , getMBstring( cat.msg_BT_put_constant_stringNotify0.getstr() ) ] )
  160.  
  161.     domethod( self.bt_put_variable , [
  162.         MUIM_Notify , MUIA_Pressed , FALSE ,
  163.         self.tx_result ,
  164.         3 ,
  165.         MUIM_Set , MUIA_Text_Contents , string_var ] )
  166.  
  167.     domethod( self.bt_return_id , [
  168.         MUIM_Notify , MUIA_Pressed , FALSE ,
  169.         self.app ,
  170.         2 ,
  171.         MUIM_Application_ReturnID , ID_BUTTON_PRESSED ] )
  172.  
  173.     domethod( self.bt_call_hook , [
  174.         MUIM_Notify , MUIA_Pressed , FALSE ,
  175.         self.app ,
  176.         2 ,
  177.         MUIM_CallHook , display.button_pressed ] )
  178.  
  179.     domethod( self.bt_quit , [
  180.         MUIM_Notify , MUIA_Pressed , FALSE ,
  181.         self.app ,
  182.         2 ,
  183.         MUIM_Application_ReturnID , MUIV_Application_ReturnID_Quit ] )
  184.  
  185.     domethod( self.wi_the_window , [
  186.         MUIM_Window_SetCycleChain , self.bt_put_constant_string ,
  187.         self.bt_put_variable ,
  188.         self.bt_return_id ,
  189.         self.bt_call_hook ,
  190.         self.bt_quit ,
  191.         0 ] )
  192.  
  193.     set( self.wi_the_window ,
  194.         MUIA_Window_Open , MUI_TRUE)
  195.  
  196. ENDPROC
  197.  
  198.  
  199. ->/////////////////////////////////////////////////////////////////////////////
  200. ->//////////// Special GetString() function for MUIBuilder generated code /////
  201. ->/////////////////////////////////////////////////////////////////////////////
  202. PROC getMBstring( local_string : PTR TO CHAR ) RETURN ( IF local_string[ 1 ] = "\0" THEN ( local_string + 2 ) ELSE local_string )
  203.